<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="./Test.xhtml">



            <ui:define name="content">

                <h:commandButton action="AddTimeSet.xhtml" value="Add Time Set" type="image" image="../resources/images/table/new_icon.png" ></h:commandButton>
                <p:dataTable var="item" value="#{timeSetBean.listAllTimeSet}"
                             paginator="true" rows="10"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             rowsPerPageTemplate="5,10,15"
                             selection="selectedAU"
                             selectionMode="single">
                    <f:facet name="header">
                        List All Time Set!
                    </f:facet>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Id" />
                        </f:facet>
                        <h:outputText value="#{item.tsID}" />
                    </p:column>
                    <p:column sortBy="#{item.dateRelease}" filterBy="#{item.dateRelease}">
                        <f:facet name="header">
                            <h:outputText value="Date Release" />
                        </f:facet>
                        <h:outputText value="#{item.dateRelease}" >

                        </h:outputText>
                    </p:column>

                    <p:column sortBy="#{item.hoursStart}" filterBy="#{item.hoursStart}">
                        <f:facet name="header">
                            <h:outputText value="Hours Start" />
                        </f:facet>
                        <h:outputText value="#{item.hoursStart}" />
                    </p:column>

                    <p:column sortBy="#{item.hoursEnd}" filterBy="#{item.hoursEnd}">
                        <f:facet name="header">
                            <h:outputText value="Hours End" />
                        </f:facet>
                        <h:outputText value="#{item.hoursEnd}" />
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Update" />
                        </f:facet>
                        <h:commandButton action="updateTimeSet"  value="Update" type="image" image="../resources/images/table/action_edit.gif">
                            <f:setPropertyActionListener value="#{item}"
                                                         target="#{timeSetBean.selectTime}" />
                        </h:commandButton>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Delete" />
                        </f:facet>

                        <p:commandLink ajax="false" onclick="{if (!confirm('Are you sure!')) return false}"
                                       update="pnl,grl"  action="TimeSet" actionListener="#{timeSetBean.DeleteTimeSet(item)}">
                            <p:graphicImage style="width: 20px" value="../resources/images/table/action_delete.gif"/>

                        </p:commandLink>
                    </p:column>

                </p:dataTable>



            </ui:define>



        </ui:composition>

    </body>
</html>
